﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _Default : PageBase
{
    protected bool TEST = false;

    protected void Page_Load(object sender, EventArgs e)
    {
        bool Installed = Request.Cookies.AllKeys.Contains("Installed");
        TEST = Session["TEST"] as bool? ?? false;
        if (!TEST)
        {
            Session["TEST"] = true;
        }
        if (Installed)
        {
            int  ID = Session["ID"] as int? ?? -1;

            if (ID > 0)
            {
                Response.Redirect("/Signed");
            }
            else
            {
                Response.Redirect("/SignIn");
            }
        }
    }

    protected void SaveContent_Click(object sender, EventArgs e)
    {
        HttpCookie cookie = 
                new HttpCookie("Installed", "true");
        cookie.Expires = DateTime.MaxValue;
        Response.Cookies.Add(cookie);
        Response.Redirect("/");
    }
}